#pragma once

#include <gofcl_usbfs_dieptflen.h>

typedef struct {
	u32_s HNPTXRSAR : 16;
	u32_s HNPTXFD : 16;
} usbfs_hnptflen_s;

_Static_assert(sizeof(usbfs_hnptflen_s) == 4,
	       "Struct usbfs_hnptflen_s defined error!");

static inline void usbfs_wreg_hnptflen_s(usbfs_hnptflen_s hnptflen) {
	union {
		usbfs_hnptflen_s h;
		u32_s u;
	} hu = {
		.h = hnptflen,
	};
	usbfs_wreg(USBFS_HNPTFLEN_DIEP0TFLEN_R, hu.u);
}

static inline void usbfs_wreg_diep0tflen_s(usbfs_dieptflen_s diep0tflen) {
	union {
		usbfs_dieptflen_s d;
		u32_s u;
	} du = {
		.d = diep0tflen,
	};
	usbfs_wreg(USBFS_HNPTFLEN_DIEP0TFLEN_R, du.u);
}
